home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2005 May / CyberMycha 05-2005 (Poland).bin / Immortal / cotndemo.exe / Data1.cab / generic_movement.tai < prev    next >
Encoding:
Text File  |  2004-11-18  |  4.1 KB  |  140 lines

  1. //
  2. //    Generic Movement AI file
  3. //
  4. //    Behaviors:
  5. //
  6. //        Path to a location.
  7. //
  8. //    Notes:
  9. //
  10. //    Common modifications:
  11. //
  12. //        To test a trigger at each waypoint, place a GetNextMoveWaypoint transition specification before
  13. //            including this file.
  14. //        To test a trigger at every movement step, place an Advance transition specification before
  15. //            including this file.  BEWARE:  this trigger will potentially be tested MANY times a second.
  16. //
  17. //    Known Problems:
  18. //
  19. //    Usage:
  20. //
  21. //        To tell a unit to move to a location, give it a location goal (EEUGLocation) and set it's action
  22. //            to keeuaPrepareToMove.
  23. //
  24.  
  25. // is pathfinding complete?
  26. PrepareToMove
  27. {
  28.     allof(GoalIsLoadContainer,ContainerInRange) true(WaitForTransport)
  29.     NoMoreWaypoints true(TurnToUnitFacing)
  30.     MovePreparationComplete true(LookForEnemies)
  31. }
  32.  
  33. // are we at a waypoint?
  34. Advance
  35. {
  36.     ArrivedAtMoveWaypoint true(GetNextMoveWaypoint)
  37.     ObstacleDetected true(RepathAroundObstacle)
  38.     allof(OneWaypointRemaining,GoalIsUnit) true(ReacquireEnemyUnit)
  39.     NoMoreWaypoints true(TurnToUnitFacing)
  40. }
  41.  
  42. RepathAroundObstacle
  43. {
  44.     MovePreparationComplete true(Advance) false(ShouldIReturnToInitialContactLocation)
  45. }
  46.  
  47. // gets the next location
  48. GetNextAutoWaypoint
  49. {
  50.     UnitHasGoal true(PrepareToMove) false(ShouldIReturnToInitialContactLocation)
  51. }
  52.  
  53. // look for new waypoints and detect the end of the path
  54. GetNextMoveWaypoint
  55. {
  56.     allof(GoalIsLoadContainer,NextWaypointRetrieved) true(GetContainerProgress)
  57.     ShouldMoveToNextAutoWaypoint true(GetNextAutoWaypoint)
  58.     NextWaypointRetrieved true(LookForEnemies) false(TurnToUnitFacing)
  59. }
  60.  
  61. // turn to unit facing as specified in the location goal, if required
  62. TurnToUnitFacing
  63. {
  64.     GoalIsLoadContainer true(GetContainerProgress)
  65.     anyof(UnitFacingNotRequired,CompletedUnitFacing) true(ReacquireGoal)
  66.     UnitHasGoal false(ReacquireGoal)
  67.     JustStandingThere true(ReacquireGoal)
  68. }
  69.  
  70. // should i return to the initial contact location?
  71. ShouldIReturnToInitialContactLocation
  72. {
  73.     allof(HasValidInitialContactLocation,ReturnsToInitialContactLocation,GoalIsNotPlayerInitiated) true(ReturnToInitialContactLocation) false(Idle)
  74. }
  75.  
  76. // triggers unit to return back to it's initial contact location
  77. ReturnToInitialContactLocation
  78. {
  79.     AlwaysTrue true(PrepareToMove)
  80. }
  81.  
  82. // the order of these two specifications is important, since the false case of the second one can only be done once
  83. LookForEnemies
  84. {
  85.     allof(CanITargetEnemies,GoalIsPatrol,EnemyUnitSpotted) true(CheckRange)
  86.     allof(GoalIsLocation,AttackMoveEnabled,EnemyUnitSpotted) true(CheckRange)
  87.     allof(CanITargetEnemies,GoalIsNotPlayerInitiated,GoalIsNotAttack,EnemyUnitSpotted) true(CheckRange) false(Advance)
  88. }
  89.  
  90. // we've reached the end of the path
  91. // if no goals, ShouldIReturnToInitialContactLocation will figure out what to do
  92. ReacquireGoal
  93. {
  94.     GoalIsLocation true(Idle)
  95.     GoalIsExplore true(FindUnexploredArea)
  96.     GoalIsLoadContainer true(ReacquireLoadContainer)
  97.     UnitHasGoal false(ShouldIReturnToInitialContactLocation)
  98. }
  99.  
  100. // just for transport/garrison loading 
  101. ReacquireLoadContainer
  102. {
  103.     ContainerInRange true(WaitForTransport) false(PrepareToMove)
  104. }
  105.  
  106. FindUnexploredArea
  107. {
  108.     SearchingForAreaToExplore true(FindUnexploredArea)
  109.     NoUnexploredAreasLeft true(Idle) false(PrepareToMove)
  110. }
  111.  
  112. // for passengers only - assumption is that unit is a passenger
  113. LoadIntoContainer
  114. {
  115.     LoadableUnitLoaded true(Idle)
  116. }
  117.  
  118. // for passengers only - assumption is that unit is a passenger - order is important
  119. GetContainerProgress
  120. {
  121.     ContainerIsDead true(Idle)
  122.     ContainerHasLostGoal true(Idle)
  123.     ContainerInRange true(LoadIntoContainer)
  124.     allof(GoalIsLoadContainer,NoMoreWaypoints,HaveNotReachedRendezvousPoint) true(PrepareToMove)
  125.     allof(GoalIsLoadContainer,NoMoreWaypoints,HaveReachedRendezvousPoint) true(WaitForTransport)
  126.     NoMoreWaypoints true(PrepareToMove) false(Advance)
  127. }
  128.  
  129. WaitForTransport
  130. {
  131.     ContainerIsDead true(Idle)
  132.     ContainerHasLostGoal true(Idle)
  133.     ContainerInRange true(LoadIntoContainer)
  134.     allof(NoMoreWaypoints,ContainerHasNoMoreWaypoints) true(CannotReachContainer)
  135. }
  136.  
  137. CannotReachContainer
  138. {
  139.     AlwaysTrue true(PrepareToMove)
  140. }